package com.chang.tx.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class CheckoutServiceImpl implements CheckoutService{

    @Autowired
    private BookService bookService;
    @Override
    public void checkout(Integer[] bookIds, Integer userId) {
        for (Integer bookId: bookIds
             ) {
            bookService.buyBook(bookId,userId);
        }
    }
}
